package com.mjk.manager.satoken.conf;

import cn.dev33.satoken.stp.StpInterface;
import com.mjk.common.core.jdbc.service.plus.idbservice.BeeDBService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * 权限
 */
public class SaPermissionImpl implements StpInterface {
    @Autowired
    private BeeDBService beeDBService;

    @Override
    public List<String> getPermissionList(Object o, String s) {
        //获取用户权限 根据 o（username）
//        BeeComplexQueryWrapper wrapper = new BeeComplexQueryWrapper(new ScMenuModel(), "menu");
//        wrapper.innerJoin(ScRole2MenuModel.class, "rm").on(ScMenuModel::getMenuId, ScRole2MenuModel::getMenuId);
//        wrapper.innerJoin(ScRole2UserModel.class, "su").on(ScRole2MenuModel::getRoleId, "rm", ScRole2UserModel::getRoleId, "su");
//        wrapper.innerJoin(ScUserModel.class, "user").on(ScRole2UserModel::getUserId, "su", ScUserModel::getUserId, "user");
//        wrapper.eq(ScUserModel::getUserName, o.toString());
//        List<ScMenuModel> menus = beeDBService.findManyByComplexWrapper(wrapper);
//        return menus.stream().map(ScMenuModel::getPermission).collect(Collectors.toList());
        List roles = new ArrayList();
        roles.add("user.select");
        roles.add("user.delete");
        roles.add("user:add");
        return roles;
    }

    @Override
    public List<String> getRoleList(Object o, String s) {

        return new ArrayList<>();
    }
}
